<%-- 
    Document   : profile
    Created on : Apr 1, 2014, 5:41:38 PM
    Author     : asmaa
--%>

<%@include file="header.jsp" %>


<sql:query dataSource="${conn}" var="result">
    SELECT * from User where id=?
    <sql:param value="${param.id}" />
</sql:query>
<div class="top_bg">
    <div class="wrap">
        <div class="main_top">
            <h2 class="style">Profile</h2>
        </div>
    </div>
</div>
    <script>
    function EditUser(id)
    {
        location.href="profileEdit.jsp?id="+id
    }
</script>
<div class="container">
    <div class="row">
        <div class="col-md-12" style="margin-left: 60px;margin-top: 20px">
            <div class="panel panel-default">
                <div class="panel-body">
                    <c:forEach var="row" items="${result.rows}">
                        <form role="form"  >
                            <div class="form-group">
                                <input type="hidden" value="${row.id}">
                                <img src="DisplayUserImage?id=${row.id}" name="image" style="height:250px;weidth:300px;" alt="Responsive image"><br>
                            </div>
                            <div class="form-group">
                                <label for="name">Name</label><br>
                                <input type="text" name="name" disabled required value="${row.name}">
                            </div>
                            <div class="form-group">
                                <label for="job">Job</label><br>
                                <input name="job" disabled required value="${row.job}">
                            </div>
                            <div class="form-group">
                                <label for="address">Address</label><br>
                                <input type="text" required disabled name="address" value="${row.address}">
                            </div>
                            <div class="form-group">
                                <label for="email">Email</label><br>
                                <input type="text" required disabled name="email" value="${row.email}">
                            </div>
                            <div class="form-group">
                                <label for="interest">interest</label><br>
                                <input type="text" required disabled name="interest" value="${row.interest}">
                            </div>
                            <div class="form-group">
                                <label for="birthday">Birthday</label><br>
                                <input type="text" required disabled name="birthday" value="${row.birthday}">
                            </div>
                                <c:if test="${!empty sessionScope.email && ( sessionScope.id == param.id || sessionScope.role == 1 ) }">
                                    <div class="form-group"> 
                                        <button type="button" onclick="EditUser(${row.id})" class="btn btn-sm btn-success">Edit</button>
                                    </div>
                                </c:if>                            
                        </c:forEach>   
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<%@include file="footer.jsp" %>